﻿# Once done, this will define
#
# JSONCPP_INCLUDE_DIR - theJSONCPP include directory
# JSONCPP_LIBRARY_DIR - theJSONCPP library directory
# JSONCPP_LIBS - link these to useJSONCPP
#
#  ......

MACRO(LOAD_LIBJSONCPP os arch)
    MESSAGE(INFO "--------------------------------")
    SET(3RDPARTY_DIR ${PROJECT_SOURCE_DIR}/3rdparty/target/${${os}}_${${arch}})
    MESSAGE(STATUS "3RDPARTY_DIR: ${3RDPARTY_DIR}")
    #FIND_FILE(JSONCPP_INCLUDE_DIR include ${3RDPARTY_DIR} NO_DEFAULT_PATH)
    #FIND_FILE(JSONCPP_LIBRARY_DIR lib ${3RDPARTY_DIR} NO_DEFAULT_PATH)
    SET(JSONCPP_INCLUDE_DIR ${3RDPARTY_DIR}/jsoncpp/include)
    SET(JSONCPP_LIBRARY_DIR ${3RDPARTY_DIR}/lib)
    IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
        SET(JSONCPP_LIBS jsoncpp_static)
    ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
        SET(JSONCPP_LIBS jsoncpp_static)
    ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux")

    IF(JSONCPP_INCLUDE_DIR)
        #SET(JSONCPP_LIBRARY_DIR "${JSONCPP_LIBRARY_DIR}/json-cpp")
        #SET(JSONCPP_LIBS "${JSONCPP_LIBRARY_DIR}/libjsoncpp.a")
        MESSAGE(STATUS "JSONCPP_INCLUDE_DIR : ${JSONCPP_INCLUDE_DIR}")
        MESSAGE(STATUS "JSONCPP_LIBRARY_DIR : ${JSONCPP_LIBRARY_DIR}")
        MESSAGE(STATUS "JSONCPP_LIBS : ${JSONCPP_LIBS}")
    ELSE()
        MESSAGE(FATAL_ERROR "json-cpp not found!")
    ENDIF()
ENDMACRO()
